<?php

namespace App\Model\Product;

use App\Model\Model;
use Hyperf\Database\Model\SoftDeletes;

/**
 * @property integer $id
 * @property integer $product_id
 * @property string $suk
 * @property integer $stock
 * @property integer $sales
 * @property decimal $price
 * @property string $image
 * @property string $unique
 * @property decimal $cost
 * @property string $bar_code
 * @property decimal $ot_price
 * @property decimal $vip_price
 * @property decimal $weight
 * @property decimal $volume
 * @property decimal $brokerage
 * @property decimal $brokerage_two
 * @property boolean $type
 * @property integer $quota
 * @property integer $quota_show
 * @property boolean $is_virtual
 * @property integer $coupon_id
 * @property text $disk_info
 */
class StoreProductAttrValue extends Model
{
    use SoftDeletes;

    
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'store_product_attr_value';

    protected $fillable = [
        'product_id',
        'suk',
        'stock',
        'sales',
        'price',
        'image',
        'unique',
        'cost',
        'bar_code',
        'ot_price',
        'vip_price',
        'weight',
        'volume',
        'brokerage',
        'brokerage_two',
        'type',
        'quota',
        'quota_show',
        'is_virtual',
        'coupon_id',
        'disk_info',
    ];
    
    public function setUniqueAttribute(){
        if(empty($value)){
            $value = uniqid(true);
        }
          $this->attributes['unique'] = $value;
    }
}
